package model

import (
	"bytes"
	"encoding/json"
	"io"
	"net/http"
)

func ESBySearch() {
	var goods Goods

	marshal, err := json.Marshal(goods)
	if err != nil {
		return
	}

	response, err := http.Post("http://113.44.72.167:9200/goods/_search", "application/json", io.Reader(bytes.NewBuffer(marshal)))
	if err != nil {
		return
	}
	defer response.Body.Close()
	body, err := io.ReadAll(response.Body)
	if err != nil {
		return
	}

	json.Unmarshal(body, &goods)
}
